#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

#ifdef DEBUG
#define debugf(f, ...) printf(f, __VA_ARGS__ )
#else
#define debugf(f, ...)
#endif

const char *options = "n:f:t:a:p:c:g:d:";

void usage(char *n) {
   printf ("%s -n <node type> -t <title> [-f <filename>] [-c <cue sheet>] [-a <Artist / Author / Director>] [-p <Cover Art / Picture>] [-g <genre tag>,...] [-d <subdir>,...]\n",n);
}

int main(int argc, char *argv[]) {
   char *type = NULL;
   char *file = NULL;
   char *title = NULL;
   char *cue = NULL;
   char *author = NULL;
   char *picture = NULL;
   char *genre = NULL;
   char *dirs = NULL;
   int optc = 0;
   
   while ( (optc = getopt(argc,argv,options) ) != -1) {
      switch (optc) {
         case 'n':
            type = optarg;
            break;
         case 'f':
            file = optarg;
            break;
         case 't':
            title = optarg;
            break;
         case 'a':
            author = optarg;
            break;
         case 'p':
            picture = optarg;
            break;
         case 'c':
            cue = optarg;
            break;
         case 'g':
            genre = optarg;
            break;
         case 'd':
            dirs = optarg;
            break;
         case ':':
         case '?':
         default:
            usage(argv[0]);
            exit(0);
      }
   }
   debugf("Type: %s\n",type);
   debugf("File: %s\n",file);
   debugf("Title: %s\n", title);
   debugf("Cue: %s\n", cue);
   debugf("Author: %s\n", author);
   debugf("Picture: %s\n", picture);
   debugf("Genre: %s\n", genre);
   debugf("Dirs: %s\n",dirs);
   return 0;
}